//
//  WeChooseTableViewCell.m
//  代号：47
//
//  Created by lanou3g on 15/7/2.
//  Copyright (c) 2015年 杨佩璋. All rights reserved.
//

#import "WeChooseTableViewCell.h"
#import <UIImageView+WebCache.h>

@interface WeChooseTableViewCell ()
@property (nonatomic ,retain)UIImageView *picImageView;//图片
@property (nonatomic ,retain)UILabel *titleLabel;//标题
@property (nonatomic ,retain)UILabel *contentLabel;//内容

@end


@implementation WeChooseTableViewCell


- (void)dealloc
{
    [_picImageView release];
    [_titleLabel release];
    [_contentLabel release];
    [super dealloc];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(kLeftPadding, kTopPadding, kScreen_width - 2 *kLeftPadding, 30)];
        _titleLabel.numberOfLines = 0;
        _titleLabel.textColor = [UIColor orangeColor];
        _titleLabel.font = [UIFont boldSystemFontOfSize:14];
//        _titleLabel.backgroundColor = RandomColor;
        [self.contentView addSubview:_titleLabel];
        
        
        _picImageView = [[UIImageView alloc] initWithFrame:CGRectMake(kLeftPadding, _titleLabel.frame.origin.y + _titleLabel.frame.size.height + kLinePadding, kScreen_width * 0.4, kScreen_width * 0.4 * 0.53)];
//        _picImageView.backgroundColor = RandomColor;
        [self.contentView addSubview:_picImageView];
        
        
        _contentLabel = [[UILabel alloc] initWithFrame:CGRectMake(kLeftPadding + kScreen_width * 0.4 + kLinePadding, _picImageView.frame.origin.y,kScreen_width - (kLeftPadding + kScreen_width * 0.4 + kLinePadding + kRightPadding), _picImageView.frame.size.height)];
//        _contentLabel.backgroundColor = RandomColor;
        _contentLabel.numberOfLines = 0;
        _contentLabel.font = [UIFont systemFontOfSize:12];
        _contentLabel.textColor = [UIColor lightGrayColor];
        [self.contentView addSubview:_contentLabel];
        
        
    }
    return self;
    
}

-(void)setChooseModel:(WechooseModel *)chooseModel{
    
    if (_chooseModel != nil) {
        [_chooseModel release];
        _chooseModel = [chooseModel retain];
    }
    
    _titleLabel.text = chooseModel.title;
    _contentLabel.text = chooseModel.content;
    [_picImageView sd_setImageWithURL:[NSURL URLWithString:chooseModel.coverimg]];
    
    
    
}

+ (CGFloat)heightForCellForDifferentSize{
    
    return kTopPadding + 30 + kLinePadding + kScreen_width * 0.4 * 0.53 + kTopPadding;
    
}

@end
